#ifndef _POINT_H_
#define _POINT_H_

class Point2D
{
public:
	Point2D() : x(0), y(0) {};
	Point2D(int x1, int y1) : x(x1), y(y1) {};
	~Point2D() {};

	inline void operator+=(Point2D p){ this->x += p.x; this->y += p.y;};
	inline void operator-=(Point2D p){ this->x -= p.x; this->y -= p.y;};
	inline void operator= (Point2D p){ this->x = p.x;  this->y = p.y; };
	inline bool operator!=(Point2D p){ return this->x != p.x || this->y != p.y;};

	/************************************************************************/
	/* rot 2pi 0 - 65536													*/
	/************************************************************************/
	void RotateTransform(int rot);

	void TranslateTransform(int tx, int ty);

public:
	int x;
	int y;
};
class PointLink
{
public:
	PointLink():PointA(0),PointB(0){};
	PointLink(int a, int b):PointA(a),PointB(b){};
	~PointLink(){};


	inline bool operator==(PointLink link)
	{
		return (PointA == link.PointA && PointB == link.PointB) ||(PointB == link.PointA && PointA == link.PointB);
	};

	inline bool operator!=(PointLink link)
	{
		return (PointA != link.PointA || PointB != link.PointB) && (PointB != link.PointA || PointA != link.PointB);
	};

	inline void operator=(PointLink link)
	{
		 PointA = link.PointA; 
		 PointB = link.PointB;
	};


	inline bool HasPoint(short index){return PointA == index || PointB == index;};

	short PointA;
	short PointB;
};

class Point2DEx : public Point2D
{
public:
	int shape;
};

#endif // _POINT_H_